<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Carte mère:  Fichier source de src/generic.h</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Généré par Doxygen 1.7.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="main.html"><span>Page&#160;principale</span></a></li>
      <li><a href="pages.html"><span>Pages&#160;associées</span></a></li>
      <li><a href="annotated.html"><span>Structures&#160;de&#160;données</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Liste&#160;des&#160;fichiers</span></a></li>
      <li><a href="globals.html"><span>Portée&#160;globale</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>src/generic.h</h1>  </div>
</div>
<div class="contents">
<a href="generic_8h.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**********************************</span>
<a name="l00002"></a>00002 <span class="comment">* generic.h</span>
<a name="l00003"></a>00003 <span class="comment">* Constantes et fonctions génériques (conversion de données, saturation, ...)</span>
<a name="l00004"></a>00004 <span class="comment">* Par Guillaume STRUB (MIQ4) le 16/12/2010</span>
<a name="l00005"></a>00005 <span class="comment">**********************************/</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="preprocessor">#ifndef _GENERIC_H</span>
<a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define _GENERIC_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span>
<a name="l00010"></a>00010 <span class="comment">/* Constantes génériques */</span>
<a name="l00011"></a><a class="code" href="generic_8h.html#aa8cecfc5c5c054d2875c03e77b7be15d">00011</a> <span class="preprocessor">#define TRUE                            1</span>
<a name="l00012"></a><a class="code" href="generic_8h.html#aa93f0eb578d23995850d61f7d61c55c1">00012</a> <span class="preprocessor"></span><span class="preprocessor">#define FALSE                           0</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">//! Change l&#39;endianness d&#39;un mot de 4 octets</span>
<a name="l00015"></a>00015 <span class="comment"></span><span class="comment">/*!</span>
<a name="l00016"></a>00016 <span class="comment">Cette fonction copie un mot de 4 octets en inversant l&#39;ordre des octets.</span>
<a name="l00017"></a>00017 <span class="comment">Elle est notamment utilisée pour réaliser une conversion Big-Endian (IMU) vers Little-Endian (PIC).</span>
<a name="l00018"></a>00018 <span class="comment">\param dest adresse de destination</span>
<a name="l00019"></a>00019 <span class="comment">\param source adresse du mot de 4 octets à copier</span>
<a name="l00020"></a>00020 <span class="comment">\sa byteSwap2</span>
<a name="l00021"></a>00021 <span class="comment">*/</span>
<a name="l00022"></a>00022 <span class="keywordtype">void</span> <a class="code" href="generic_8c.html#aa6e19c4c858eed74b0d846af33b67a4d" title="Change l&amp;#39;endianness d&amp;#39;un mot de 4 octets.">byteSwap4</a> (<span class="keywordtype">void</span>* dest, <span class="keyword">const</span> <span class="keywordtype">void</span>* source);
<a name="l00023"></a>00023 <span class="comment"></span>
<a name="l00024"></a>00024 <span class="comment">//! Change l&#39;endianness d&#39;un mot de 2 octets</span>
<a name="l00025"></a>00025 <span class="comment"></span><span class="comment">/*!</span>
<a name="l00026"></a>00026 <span class="comment">Cette fonction copie un mot de 2 octets en inversant l&#39;ordre des octets.</span>
<a name="l00027"></a>00027 <span class="comment">Elle est notamment utilisée pour réaliser une conversion Big-Endian (IMU) vers Little-Endian (PIC).</span>
<a name="l00028"></a>00028 <span class="comment">\param dest adresse de destination</span>
<a name="l00029"></a>00029 <span class="comment">\param source adresse du mot de 2 octets à copier</span>
<a name="l00030"></a>00030 <span class="comment">\sa byteSwap4</span>
<a name="l00031"></a>00031 <span class="comment">*/</span>
<a name="l00032"></a>00032 <span class="keywordtype">void</span> <a class="code" href="generic_8c.html#a1deebfd54446b8c32946fba61f9c3c2f" title="Change l&amp;#39;endianness d&amp;#39;un mot de 2 octets.">byteSwap2</a> (<span class="keywordtype">void</span>* dest, <span class="keyword">const</span> <span class="keywordtype">void</span>* source);
<a name="l00033"></a>00033 <span class="comment"></span>
<a name="l00034"></a>00034 <span class="comment">//! Limite une variable entre deux bornes symétriques</span>
<a name="l00035"></a>00035 <span class="comment"></span><span class="comment">/*!</span>
<a name="l00036"></a>00036 <span class="comment">Cette fonction permet de limiter une variable entre deux bornes, symétriquement par rapport à 0.</span>
<a name="l00037"></a>00037 <span class="comment">\param variable la variable à borner</span>
<a name="l00038"></a>00038 <span class="comment">\param borne la valeur de saturation positive et négative</span>
<a name="l00039"></a>00039 <span class="comment">\return variable bornée entre -borne et +borne</span>
<a name="l00040"></a>00040 <span class="comment">*/</span>
<a name="l00041"></a>00041 <span class="keywordtype">float</span> <a class="code" href="generic_8c.html#aa9b77e881b49601b5cf2d6ddd9c2abf7" title="Limite une variable entre deux bornes symétriques.">saturation</a> (<span class="keywordtype">float</span> variable, <span class="keywordtype">float</span> borne);
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Généré le Wed Jan 5 2011 17:04:29 pour Carte mère par&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
</body>
</html>
